﻿#region Namespace References

using System;
using DynConDevCorp.OpenArch.SmartData.Interfaces;

#endregion

namespace DynConDevCorp.OpenArch.SmartData.Interfaces
{
    /// <summary>
    /// Standard Delegate for converting a string to a specific Type
    /// </summary>
    public delegate TData ParseHandler<TData>(string source);

    /// <summary>
    /// Base Interface for Parsers used to translate InputValue to Value for ISmartFields.
    /// </summary>
    public interface ISmartInputParser : ISmartProperty
    {
        #region Public Instance Properties

        /// <summary>
        /// Gets the type of the target.
        /// </summary>
        /// <value>The type of the target.</value>
        Type TargetType { get; }

        #endregion
    }

    /// <summary>
    /// Type Safe Interface for Parsers used to translate InputValue to Value for ISmartFields.
    /// </summary>
    /// <typeparam name="TData">The type of the date to be parsed.</typeparam>
    public interface ISmartInputParser<TData> : ISmartInputParser
    {
        #region Public Instance Methods

        /// <summary>
        /// Parses the specified input.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns></returns>
        TData Parse(string input);

        #endregion
    }
}